<h2>Kokku leiti <?php echo count($results) ?> uut sportlast. </h2>

<?php
echo form_open('files/add_athletes');
echo form_hidden('full_path', $full_path);
echo form_submit('add_athletes', 'Lisa kõik andmebaasi');
echo form_close();
?>

<table class="klubid">
    <tr>
        <th>Eesnimi</th>
        <th>Perenimi</th>
        <th>Sugu</th>
        <th>Sünniaeg</th>
        <th>Klubi</th>
    </tr>

    <?php
    foreach ($results as /* @var $athlete Athlete */ $athlete) {

        $exists = ($athlete->getTeamID() !== 0);
        if (!$exists) {
            echo '<tr class="team_missing">';
        } else {
            echo '<tr>';
        }
        echo '<td>' . $athlete->getFirstName() . '</td>';
        echo '<td>' . $athlete->getLastName() . '</td>';
        echo '<td>' . $athlete->getGender() . '</td>';
        echo '<td>' . $athlete->getDob() . '</td>';
        if ($exists) {
            echo '<td>' . $athlete->getTeam()->getFullName() . '</td>';
        } else {
            echo '<td>Ei leitud</td>';
        }
        echo '</tr>';
    }
    ?>
</table>